#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->lineEdit_name->setPlaceholderText("请输入姓名");
    ui->lineEdit_name->setClearButtonEnabled(true);

    ui->lineEdit_pass->setPlaceholderText("请输入密码");
    ui->lineEdit_pass->setClearButtonEnabled(true);
    ui->lineEdit_pass->setEchoMode(QLineEdit::Password);

    ui->lineEdit_telnum->setPlaceholderText("请输入电话");
    ui->lineEdit_telnum->setClearButtonEnabled(true);
    ui->lineEdit_telnum->setInputMask("000-0000-0000");
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QString gender = ui->radioButton_man->isChecked() ? "男" : "女";
    qDebug() << "姓名: " << ui->lineEdit_name->text() << "\n"
             << "密码: " << ui->lineEdit_pass->text() << "\n"
             << "性别: " << gender << "\n"
             << "电话: " << ui->lineEdit_telnum->text() << "\n";
}
